Fractale Tree  0.5
Plot Tree Fractale
Public Slots | Signals | Public Member Functions | Private Attributes | List of all members
QWidget_trees Class Reference

#include <qwidget_trees.h>

Inheritance diagram for QWidget_trees:
Inheritance graph
[legend]
Collaboration diagram for QWidget_trees:
Collaboration graph
[legend]

Public Slots

void Update_Value ()
 

Signals

void Value_changed ()
 

Public Member Functions

 QWidget_trees ()
 
int Get_Nb_Widget_tree ()
 
int Get_Value_By_Index (int index)
 
Stock_Prcent Get_Stock_Prcent ()
 
void Set_Value_By_Index (int index, int value)
 

Private Attributes

int nb_Widget_tree
 
QWidget_treeTab_Widget_tree [10]
 
QHBoxLayout * HBoxLayout
 
Stock_Prcent stock_prcent
 

Detailed Description

Definition at line 21 of file qwidget_trees.h.

Constructor & Destructor Documentation

◆ QWidget_trees()

QWidget_trees::QWidget_trees ( )
explicit

Definition at line 3 of file qwidget_trees.cpp.

References HBoxLayout, nb_Widget_tree, Stock_Prcent::Set_Size(), stock_prcent, Tab_Widget_tree, Update_Value(), and Value_changed().

3  : QWidget()
4 {
5  qDebug() << "Etape 2.1";
6  //Init
9 
10  // HBoxLayou_tree
11  QHBoxLayout *HBoxLayou_tree = new QHBoxLayout;
12  //Boucle Tab_Widget_tree
13  for(int i=0;i<nb_Widget_tree;i++)
14  {
15  Tab_Widget_tree[i] = new QWidget_tree();
16  HBoxLayou_tree->addWidget(Tab_Widget_tree[i]);
17  QObject::connect(Tab_Widget_tree[i],SIGNAL(Value_changed()),this,SIGNAL(Value_changed()));
18  }
19  //QGroupBox_tree
20  QGroupBox *QGroupBox_tree = new QGroupBox(tr("Tree"));
21  QGroupBox_tree->setLayout(HBoxLayou_tree);
22 
23  // HBoxLayout
24  HBoxLayout = new QHBoxLayout();
25  HBoxLayout->addWidget(QGroupBox_tree);
26 
27  //setLayout
28  this->setLayout(HBoxLayout);
29 
30  //Upadate
31  Update_Value();
32 
33  //
34  QObject::connect(this,SIGNAL(Value_changed()),this,SLOT(Update_Value()));
35 }
QWidget_tree * Tab_Widget_tree[10]
Definition: qwidget_trees.h:38
void Value_changed()
void Set_Size(int size)
Definition: stock_prcent.cpp:8
QHBoxLayout * HBoxLayout
Definition: qwidget_trees.h:40
Stock_Prcent stock_prcent
Definition: qwidget_trees.h:42
Here is the call graph for this function:

Member Function Documentation

◆ Get_Nb_Widget_tree()

int QWidget_trees::Get_Nb_Widget_tree ( )

Definition at line 69 of file qwidget_trees.cpp.

References nb_Widget_tree.

Referenced by Main_fenetre::Save_file().

70 {
71  return nb_Widget_tree;
72 }
Here is the caller graph for this function:

◆ Get_Stock_Prcent()

Stock_Prcent QWidget_trees::Get_Stock_Prcent ( )

Definition at line 54 of file qwidget_trees.cpp.

References stock_prcent.

Referenced by Draw_Tree::Plot().

55 {
56  return stock_prcent;
57 }
Stock_Prcent stock_prcent
Definition: qwidget_trees.h:42
Here is the caller graph for this function:

◆ Get_Value_By_Index()

int QWidget_trees::Get_Value_By_Index ( int  index)

Definition at line 60 of file qwidget_trees.cpp.

References QWidget_tree::Get_Value(), nb_Widget_tree, and Tab_Widget_tree.

Referenced by Main_fenetre::Save_file().

61 {
62  if(index>=0 && index<nb_Widget_tree)
63  {
64  return Tab_Widget_tree[index]->Get_Value();
65  }
66  return 0;
67 }
QWidget_tree * Tab_Widget_tree[10]
Definition: qwidget_trees.h:38
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Set_Value_By_Index()

void QWidget_trees::Set_Value_By_Index ( int  index,
int  value 
)

Definition at line 75 of file qwidget_trees.cpp.

References nb_Widget_tree, QWidget_tree::Set_Value(), and Tab_Widget_tree.

Referenced by Main_fenetre::Main_fenetre(), and Main_fenetre::Open_file().

76 {
77  if(index>=0 && index<nb_Widget_tree)
78  {
79  Tab_Widget_tree[index]->Set_Value(value);
80  }
81 }
QWidget_tree * Tab_Widget_tree[10]
Definition: qwidget_trees.h:38
void Set_Value(int value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update_Value

void QWidget_trees::Update_Value ( )
slot

Definition at line 37 of file qwidget_trees.cpp.

References QWidget_tree::Get_Value(), nb_Widget_tree, QWidget_tree::Set_Prcent(), Stock_Prcent::Set_Prcent_By_Index(), stock_prcent, and Tab_Widget_tree.

Referenced by QWidget_trees().

38 {
39  int total=0;
40  for(int i=0;i<nb_Widget_tree;i++)
41  {
42  total=total+Tab_Widget_tree[i]->Get_Value();
43  }
44  double prcent=100/((double)total);
45  for(int i=0;i<nb_Widget_tree;i++)
46  {
47  int value=Tab_Widget_tree[i]->Get_Value();
48  Tab_Widget_tree[i]->Set_Prcent(value*prcent);
49  stock_prcent.Set_Prcent_By_Index(i,value*prcent);
50  }
51 }
void Set_Prcent_By_Index(int index, double prcent)
QWidget_tree * Tab_Widget_tree[10]
Definition: qwidget_trees.h:38
void Set_Prcent(double prcent)
Stock_Prcent stock_prcent
Definition: qwidget_trees.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Value_changed

void QWidget_trees::Value_changed ( )
signal

Referenced by QWidget_trees().

Here is the caller graph for this function:

Member Data Documentation

◆ HBoxLayout

QHBoxLayout* QWidget_trees::HBoxLayout
private

Definition at line 40 of file qwidget_trees.h.

Referenced by QWidget_trees().

◆ nb_Widget_tree

int QWidget_trees::nb_Widget_tree
private

◆ stock_prcent

Stock_Prcent QWidget_trees::stock_prcent
private

Definition at line 42 of file qwidget_trees.h.

Referenced by Get_Stock_Prcent(), QWidget_trees(), and Update_Value().

◆ Tab_Widget_tree

QWidget_tree* QWidget_trees::Tab_Widget_tree[10]
private

The documentation for this class was generated from the following files: